//功能：ILI9488初始化 RGB565模式
module ILI9488(input         clk12p5M,                      
               input         rst_n,
					//local interface
					input [9:0]   x_start,//横坐标起始
					input [9:0]   x_end,  //横坐标结束
					input [9:0]   y_start,//纵坐标起始
					input [9:0]   y_end,  //纵坐标起始
		         input [15:0]  color,      //RGB565
					input         sop,
		         input         write_en,   //high active
		         output        write_ready,//write_en拉高后必须等待write_ready为高才表示
					output        lcd_intdone,//TFTLCD 初始化完成标志，高有效
					//TFTLCD interface
					output        WR,
					output        RD,
					output        CS,
					output        RS,
					output        BL_cnt,
					output [15:0] data,
					output        RESET
					);
assign lcd_intdone = init_done;
//wire clk12_5_w;
//clk12_5M u0(.clk50M(clk50M),
//            .rst_n(rst_n),
//				.clk12_5(clk12_5_w));
wire [17:0] index_w0,index_w1,index_w;
wire        init_done;
index_lut u1(.clk(clk12p5M),
             .rst_n(rst_n),
				 .index(index_w0),
				 .init_done(init_done)
				 );
wire [9:0] test_source_w;
issp u_issp_0 (
	.probe(),
	.source(test_source_w)
	);
LCD_DrawPoint u_LCD_DrawPoint_0(
       .clk(clk12p5M),
		 .rst_n(rst_n),
		 .x_start(x_start),//横坐标
		 .x_end(x_end),
		 .y_start(y_start),
		 .y_end(y_end),//纵坐标
		 .color(color),//RGB565
		 .sop(sop),
		 .write_en(write_en && init_done),//high active
		 .write_ready(write_ready),//write_en拉高后必须等待write_ready为高才表示
		 .index(index_w1)
);
wire [3:0] judge_code_0;
assign judge_code_0 = init_done?4'h1:4'h0;
bus_judge u_bus_judge_0(
       .judge_code(judge_code_0), //仲裁码
		 .index_0(index_w0),
		 .index_1(index_w1),
		 .index(index_w)
);
intface8080(.clk(clk12p5M),
            .rst_n(rst_n),
				.index(index_w),//index[17]为高表示读，为低表示写，index[16]为高表示index[15:0]为数据，为低表示index[15:0]为指令
				.WR(WR),
				.RD(RD),
				.CS(CS),
				.RS(RS),
				.BL_cnt(BL_cnt),
				.data(data),
				.RESET(RESET)				
						 );//16bit 8080 接口
endmodule 